/*
 * Copyright (C) 2016 Baidu, Inc. All Rights Reserved.
 */
package me.cuilei.springbootdemo.user;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by cuilei05 on 16/9/28.
 */
@Transactional(readOnly = false)
public interface UserRepository extends Repository<User, Long> {
    Page<User> findAll(Pageable pageable);

    User findByUserId(Long id);

    @Query("select u from galaxy_user u where u.userName like %?1%")
    List<User> searchByUserName(String name);
}
